package com.kiliter.config;

import cn.dev33.satoken.interceptor.SaRouteInterceptor;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName zhangjl
 *
 * @date 2021/6/4 13:56 @Version 1.0
 */
@Component
public class AuthConfig implements WebMvcConfigurer {

  // 注册sa-token的登录拦截器
  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    // 注册登录拦截器，并排除登录接口地址
    registry
        .addInterceptor(new SaRouteInterceptor())
        .addPathPatterns("/**")
        .excludePathPatterns("/user/login");
  }
}
